//
//  ZSButton.swift
//  ZSWeibo
//
//  Created by zsj1992 on 16/4/15.
//  Copyright © 2016年 ichange. All rights reserved.
//

import UIKit
//contentRect = (0,0,80,110)
private let imageW: CGFloat = 80

class ZSButton: UIButton {
    
    var composeItem: ZSComposeItem? {
        didSet {
            setTitle(composeItem?.title, forState: .Normal)
            setImage(UIImage(named: composeItem?.icon ?? ""), forState: .Normal)
            self.titleLabel?.textAlignment = .Center
        }
    }


    override func imageRectForContentRect(contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: 0, width: imageW, height: imageW)
    }
    
    override func titleRectForContentRect(contentRect: CGRect) -> CGRect {
        return CGRect(x: 0, y: imageW, width: imageW, height: contentRect.size.height - imageW)
    }
}
